package com.stox.shared.indicator.model.intf;

import java.util.List;

import com.stox.shared.core.model.Bar;
import com.stox.shared.indicator.model.SimpleMovingAverage;
import com.stox.shared.indicator.model.Value;
import com.stox.shared.indicator.model.enumeration.IndicatorDisplayType;
import com.stox.shared.indicator.model.enumeration.IndicatorPosition;

public interface Indicator<OUT, CONFIG> {
	
	Indicator<?,?>[] ALL = {SimpleMovingAverage.INSTANCE};

	public String getCode();

	public IndicatorPosition getPosition(CONFIG config);

	public String getDisplayName();

	public IndicatorDisplayType getDisplayType(CONFIG config);

	/**
	 * The indicator may or may not support this method, if it needs more information from Bar other than simple double
	 * array
	 *
	 * @param configuration
	 * @param in
	 * @param index
	 * @return
	 * @throws UnsupportedOperationException
	 */
	public Value<OUT> getValue(CONFIG configuration, Value<Double>[] in, int index) throws UnsupportedOperationException;

	public Value<OUT> getValue(CONFIG configuration, List<Bar> bars, int index);

	/**
	 * The indicator may or may not support this method, if it needs more information from Bar other than simple double
	 * array
	 *
	 * @param configuration
	 * @param in
	 * @return
	 * @throws UnsupportedOperationException
	 */
	public Value<OUT>[] getValues(CONFIG configuration, Value<Double>[] in) throws UnsupportedOperationException;

	public Value<OUT>[] getValues(CONFIG configuration, List<Bar> bars);

	public CONFIG createDefaultConfiguration();

}
